<template>
	<page-body>
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center searchs_flex_0_ben"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between flex-sub searchs_fd0_0_ben'>
					<text class='fu-iconfont2  searchs_fd0_0_c0_ben' @tap.stop="handleJumpDiy" data-type="back"
						data-url="1">&#xE794;</text>
					<view class='flex flex-wrap align-center flex-sub searchs_fd0_0_c1_ben'>
						<image class='searchs_fd0_0_c1_c0_ben' mode="aspectFit" :src='STATIC_URL+"serse.png"'></image>
						<benben-input class='flex-sub searchs_fd0_0_c1_c1_ben' type="text" :placeholder="$t('搜索')"
							confirm-type="done" :maxlength="-1" placeholder-style="color:#999;font-size:28rpx"
							@confirm="addSearchHistoryFunc()" v-model="KeyWord" />
					</view>
					<text class='searchs_fd0_0_c2_ben' @tap.stop="addSearchHistoryFunc()">{{$t('搜索')}}</text>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>

			<!---历史搜索 -->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout searchs_flex_1_ben">
				<view class='flex flex-wrap align-center searchs_fd1_0_ben'>
					<view class='flex flex-wrap align-center searchs_fd1_0_c0_ben'>
					</view>
					<text class='searchs_fd1_0_c1_ben'>{{$t('历史搜索')}}</text>
					<image class='searchs_fd1_0_c2_ben' mode="aspectFit" :src='STATIC_URL+"delete.png"'
						@tap.stop="popupShow1661481796822=true"></image>
				</view>
				<view class='flex flex-wrap align-center' v-if=" appSearchHistory.length!=0">
					<template v-for='(item,key0) in appSearchHistory'>
						<view class='flex flex-wrap align-center searchs_fd1_1_c0_ben' @tap.stop="handleJumpDiy"
							data-type="navigateTo" :data-url="`/pages/index/indSeaRes/indSeaRes?KeyWord=${item.name}`"
							:key='key0'>
							<text class='searchs_fd1_1_c0_c0_ben'>{{item.name}}</text>
						</view>
					</template>

				</view>
				<text v-if=" appSearchHistory.length==0" class='searchs_fd1_2_ben'>{{$t('暂无历史记录')}}</text>
			</view>

			<!---热门搜索-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout searchs_flex_1_ben">
				<view class='flex flex-wrap align-center searchs_fd1_0_ben'>
					<view class='flex flex-wrap align-center searchs_fd1_0_c0_ben'>
					</view>
					<text class='searchs_fd1_0_c1_ben'>{{$t('热门搜索')}}</text>
				</view>
				<view class='flex flex-wrap align-center'>
					<template v-for='(item,index) in 4'>
						<view class='flex flex-wrap align-center searchs_fd1_1_c0_ben' @tap.stop="handleJumpDiy"
							data-type="navigateTo" :data-url="`/pages/index/indSeaRes/indSeaRes?KeyWord=${index}`"
							:key='index'>
							<text class='searchs_fd1_1_c0_c0_ben'>{{index}}热门</text>
						</view>
					</template>

				</view>
			</view>


			<!---搜索记录flex布局结束-->
			<benben-popup v-model="popupShow1661481796822" :mask="true" :mask-close-able="true" mode='center'>
				<!---删除历史记录弹窗flex布局开始-->
				<view class="flex flex-direction flex-wrap align-center searchs_flex_2_ben">
					<text class='searchs_fd2_0_ben'>{{$t('提示')}}</text>
					<text class='searchs_fd2_1_ben'>{{$t('确定删除历史记录？')}}</text>
					<view class='flex flex-wrap align-center searchs_fd2_2_ben'>
						<button class='searchs_fd2_2_c0_ben'
							@tap.stop="popupShow1661481796822=false">{{$t('取消')}}</button>
						<button class='searchs_fd2_2_c1_ben' @tap.stop="emptySearchHistoryFunc()">{{$t('确定')}}</button>
					</view>
				</view>

				<!---删除历史记录弹窗flex布局结束-->

			</benben-popup>


		</view>
	</page-body>
</template>
<script>
	export default {
		components: {},


		data() {
			return {
				"popupShow1661481796822": false,
				"KeyWord": ""
			};
		},
		computed: {
			appSearchHistory() { // 搜索历史
				return this.$store.state.appSearchHistory
			}
		},
		watch: {},
		onLoad(options) {

		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//添加搜索历史
			addSearchHistoryFunc() {
				this.$store.commit('appSearchHistoryAdd', {
					"name": this.KeyWord
				})
				this.$urouter.navigateTo(`/pages/index/indSeaRes/indSeaRes?KeyWord=${this.KeyWord}`);
				this.KeyWord = ''
			},
			//删除搜索历史
			deleteSearchHistoryFunc(name) {
				this.$store.commit('appSearchHistoryDel', {
					"name": name
				})
			},
			//清空搜索记录
			emptySearchHistoryFunc() {
				this.$store.commit('appSearchHistoryClean', '')
				this.popupShow1661481796822 = false;
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #fff;
		background-size: 100% auto;
	}

	.searchs_flex_0_ben {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.searchs_fd0_0_c2_ben {
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
		margin: -5rpx 0rpx 0rpx 24rpx;
	}

	.searchs_fd0_0_c1_c1_ben {
		margin: 10rpx 0rpx 0rpx 24rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
	}

	.searchs_fd0_0_c1_c0_ben {
		margin: -5rpx 0rpx 0rpx 0rpx;
		width: 32rpx;
		height: 32rpx;
	}

	.searchs_fd0_0_c1_ben {
		background: rgba(249, 249, 249, 1);
		background-size: 100% auto !important;
		border-radius: 34rpx 34rpx 34rpx 34rpx;
		width: 574rpx;
		height: 64rpx;
		margin: 0rpx 0rpx 0rpx 24rpx;
		padding: 0rpx 24rpx 0rpx 24rpx;
	}

	.searchs_fd0_0_c0_ben {
		font-size: 36rpx;
		color: #333;
		font-weight: 500;
	}

	.searchs_fd0_0_ben {
		padding: 0rpx 32rpx 0rpx 32rpx;
		height: 88rpx;
	}

	.searchs_flex_1_ben {
		padding: 24rpx 24rpx 0rpx 24rpx;
	}

	.searchs_fd1_2_ben {
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
	}

	.searchs_fd1_1_c0_c0_ben {
		font-size: 24rpx;
		font-weight: 400;
		color: rgba(51, 51, 51, 1);
	}

	.searchs_fd1_1_c0_ben {
		background: var(--benbenbgColor5);
		border-radius: 32rpx 32rpx 32rpx 32rpx;
		background-size: 100% auto !important;
		padding: 0rpx 40rpx 0rpx 40rpx;
		line-height: 56rpx;
		margin: 0rpx 22rpx 24rpx 0rpx;
	}

	.searchs_fd1_0_c2_ben {
		width: 32rpx;
		height: 32rpx;
		margin: 0rpx 0rpx 0rpx auto;
	}

	.searchs_fd1_0_c1_ben {
		font-size: 32rpx;
		font-weight: 500;
		color: #333;
	}

	.searchs_fd1_0_c0_ben {
		background: rgba(20, 94, 253, 1);
		width: 6rpx;
		height: 27rpx;
		background-size: 100% auto;
		border-radius: 8rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.searchs_fd1_0_ben {
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.searchs_flex_2_ben {
		background: #fff;
		margin: 0rpx 105rpx 0rpx 105rpx;
		background-size: #eee;
		border-radius: 25rpx 25rpx 25rpx 25rpx;
		padding: 40rpx 0rpx 0rpx 0rpx;
	}

	.searchs_fd2_2_c1_ben {
		background: transparent;
		line-height: 110rpx;
		border-radius: 0rpx 0rpx 16rpx 0rpx;
		font-size: 32rpx;
		color: var(--benbenFontColor7);
		width: 269rpx;
		height: 110rpx;
	}

	.searchs_fd2_2_c0_ben {
		border-right: 1px solid #EEEEEE;
		background: transparent;
		line-height: 110rpx;
		border-radius: 0rpx 0rpx 0rpx 16rpx;
		font-size: 32rpx;
		color: var(--benbenFontColor2);
		height: 110rpx;
		width: 270rpx;
	}

	.searchs_fd2_2_ben {
		border-top: 1px solid #eee;
	}

	.searchs_fd2_1_ben {
		font-size: 32rpx;
		font-weight: 400;
		line-height: 52rpx;
		color: #333333;
		margin: 40rpx 0rpx 39rpx 0rpx;
	}

	.searchs_fd2_0_ben {
		color: #333333;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 45rpx;
	}
</style>